import * as echarts from 'echarts';
export const exchangeFnc = (item, zoomScale = 1, ptype = '切换页面') => {
  let type = item.item_type, obj = {};
  if (type === 'text01') {
    obj = exchangeText(item, zoomScale, ptype);
  } else if (type === 'number01') {
    obj = exchangeNumber(item, zoomScale, ptype);
  } else if (type === 'shape01') {
    obj = exchangeShape(item, zoomScale, ptype);
  } else if (type === 'bar01') {
    obj = exchangeBar(item, zoomScale, ptype);
  } else if (type === 'line01') {
    obj = exchangeLine(item, zoomScale, ptype);
  } else if (type === 'pipeline01') {
    obj = exchangePipeline(item, zoomScale, ptype);
  } else if (type === 'picture01') {
    obj = exchangePicture(item, zoomScale, ptype);
  } else if (type === 'vButton01') {
    obj = exchangeVButton(item, zoomScale, ptype);
  } else if (type === 'switch01') {
    obj = exchangeSwitch(item, zoomScale, ptype);
  } else if (type === "gauge01") {
    obj = exchangeGauge(item, zoomScale, ptype);
  } else if (type === "lineCharts01") {
    obj = exchangeLineCharts(item, zoomScale, ptype);
  }
  return obj;
};

const exchangeText = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    symbolSize: 0,												//默认，去除默认图片
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        label: {
          verticalAlign: 'middle',				//默认，垂直对齐方式建议固定
          formatter:function(o){
            return o.name;
          },
        },
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15, arr16, arr17, arr18 ] = arr1;
  
  arr12[5] *= zoomScale;
  arr12[6] *= zoomScale;
  arr12[7] *= zoomScale;
  arr12[8] *= zoomScale;
  if (arr15.length) {
    arr15[0] *= zoomScale;
    arr15[1] *= zoomScale;
    if (typeof(arr15[3]) !== 'string') {
      arr15[3] = [arr15[3][0]*zoomScale, arr15[3][1]*zoomScale];
    }
    arr15[4] *= zoomScale;
  }
  if (arr16.length) {
    arr16[0] *= zoomScale;
  }
  if (arr17.length) {
    arr17[1] *= zoomScale;
    arr17[2] *= zoomScale;
    arr17[3] *= zoomScale;
  }
  
  if (arr0.length) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  
  if (arr10.length) {
    ['value', 'name'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['show', 'align', 'rotate', 'opacity', 'backgroundColor', 'width', 'height', 'padding', 'fontSize', 'color', 'fontWeight', 'fontStyle', 'fontFamily'].forEach((i, ind) => {
      obj.data[0].label[i] = arr12[ind];
    });
    // obj.data[0].label.width_temp = arr12[5] + 2*arr12[7];
    // obj.data[0].label.height_temp = arr12[6] + 2*arr12[7];
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].label.show = showRuleCalc(obj.data[0].showT);
    obj.data[0].label.show = true;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    
  }
  if (arr15.length) {
    ['borderRadius', 'borderWidth', 'borderColor', 'borderType', 'borderDashOffset'].forEach((i, ind) => {
      obj.data[0].label[i] = arr15[ind];
    });
    // obj.data[0].label.borderType_temp = typeof(arr15[3]) === "string" ? arr15[3] : "dashed";
  }
  if (arr16.length) {
    ['textBorderWidth', 'textBorderColor'].forEach((i, ind) => {
      obj.data[0].label[i] = arr16[ind];
    });
  }
  if (arr17.length) {
    ['textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'].forEach((i, ind) => {
      obj.data[0].label[i] = arr17[ind];
    });
  }
  if (arr18.length) {
    obj.data[0].pageT = {};
    ['fnc', 'page', 'prefix', 'title'].forEach((i, ind) => {
      obj.data[0].pageT[i] = arr18[ind];
    });
  }
  return obj;
}
const exchangeNumber = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    symbolSize: 0,												//默认，去除默认图片
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        label: {
          verticalAlign: 'middle',				//默认，垂直对齐方式建议固定
          formatter:function(o){
            return o.name;
          },
        },
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15, arr16, arr17 ] = arr1;
  
  arr12[5] *= zoomScale;
  arr12[6] *= zoomScale;
  arr12[7] *= zoomScale;
  arr12[8] *= zoomScale;
  if (arr15.length) {
    arr15[0] *= zoomScale;
    arr15[1] *= zoomScale;
    if (typeof(arr15[3]) !== 'string') {
      arr15[3] = [arr15[3][0]*zoomScale, arr15[3][1]*zoomScale];
    }
    arr15[4] *= zoomScale;
  }
  if (arr16.length) {
    arr16[0] *= zoomScale;
  }
  if (arr17.length) {
    arr17[1] *= zoomScale;
    arr17[2] *= zoomScale;
    arr17[3] *= zoomScale;
  }
  
  if (arr0.length) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['value', 'name'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['show', 'align', 'rotate', 'opacity', 'backgroundColor', 'width', 'height', 'padding', 'fontSize', 'color', 'fontWeight', 'fontStyle', 'fontFamily'].forEach((i, ind) => {
      obj.data[0].label[i] = arr12[ind];
    });
    // obj.data[0].label.width_temp = arr12[5] + 2*arr12[7];
    // obj.data[0].label.height_temp = arr12[6] + 2*arr12[7];
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].label.show = showRuleCalc(obj.data[0].showT);
    obj.data[0].label.show = true;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    obj.data[0].statusT = {};
    ['id', 'val', 'dig', 'rw', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
      obj.data[0].statusT.id = item.status_suffix_sensor;
    }
    let name = "????", statusT = obj.data[0].statusT;
    if (statusT.val !== "掉线" && statusT.val != null && statusT.val != undefined) {
      name = Number(statusT.val).toFixed(statusT.dig);
    }
    obj.data[0].name = name;
  }
  if (arr15.length) {
    ['borderRadius', 'borderWidth', 'borderColor', 'borderType', 'borderDashOffset'].forEach((i, ind) => {
      obj.data[0].label[i] = arr15[ind];
    });
    // obj.data[0].label.borderType_temp = typeof(arr15[3]) === "string" ? arr15[3] : "dashed";
  }
  if (arr16.length) {
    ['textBorderWidth', 'textBorderColor'].forEach((i, ind) => {
      obj.data[0].label[i] = arr16[ind];
    });
  }
  if (arr17.length) {
    ['textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'].forEach((i, ind) => {
      obj.data[0].label[i] = arr17[ind];
    });
  }
  return obj;
}
const exchangeShape = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    symbolSize: 0,												//默认，去除默认图片
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        name: '',													//默认，无文字
        
        label: {
          verticalAlign: 'middle',				//默认，垂直对齐方式建议固定
          align: 'center',								//默认，水平对齐方式建议固定
          formatter:function(o){
            return o.name;
          },
        },
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15, arr16, arr17, arr18 ] = arr1;
  
  arr12[4] *= zoomScale;
  arr12[5] *= zoomScale;
  arr12[6] *= zoomScale;
  if (arr15.length) {
    arr15[0] *= zoomScale;
    if (typeof(arr15[2]) !== 'string') {
      arr15[2] = [arr15[2][0]*zoomScale, arr15[2][1]*zoomScale];
    }
    arr15[3] *= zoomScale;
  }
  if (arr16.length) {
    arr16[1] *= zoomScale;
    arr16[2] *= zoomScale;
    arr16[3] *= zoomScale;
  }
  
  if (arr0.length) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['value'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['show', 'rotate', 'opacity', 'backgroundColor', 'width', 'height', 'borderRadius'].forEach((i, ind) => {
      obj.data[0].label[i] = arr12[ind];
    });
    // if (obj.data[0].label.borderRadius === obj.data[0].label.width/2 && obj.data[0].label.height === obj.data[0].label.width) {
    // 	obj.data[0].label.shapeType = 'circle';
    // } else if (obj.data[0].label.borderRadius === 0 && obj.data[0].label.height === obj.data[0].label.width) {
    // 	obj.data[0].label.shapeType = 'square';
    // } else if (obj.data[0].label.borderRadius === 0) {
    // 	obj.data[0].label.shapeType = 'rectangle';
    // } else {
    // 	obj.data[0].label.shapeType = 'radius';
    // }
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].label.show = showRuleCalc(obj.data[0].showT);
    obj.data[0].label.show = true;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    
  }
  if (arr15.length) {
    ['borderWidth', 'borderColor', 'borderType', 'borderDashOffset'].forEach((i, ind) => {
      obj.data[0].label[i] = arr15[ind];
    });
    // obj.data[0].label.borderType_temp = typeof(arr15[2]) === "string" ? arr15[2] : "dashed";
  }
  if (arr16.length) {
    ['shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'].forEach((i, ind) => {
      obj.data[0].label[i] = arr16[ind];
    });
  }
  if (arr17.length) {
    obj.data[0].bgColorfulT = {
      dir: arr17[0],
      colorArr: [],
    };
    arr17[1].forEach(r => {
      obj.data[0].bgColorfulT.colorArr.push({
        offset: r[0],
        color: r[1],
      });
    });
    let bgColorfulT = JSON.parse(JSON.stringify(obj.data[0].bgColorfulT));
    obj.data[0].label.backgroundColor = new echarts.graphic.LinearGradient(...bgColorfulT.dir, bgColorfulT.colorArr,false);
  }
  if (arr18.length) {
    obj.data[0].borderColorfulT = {
      dir: arr18[0],
      colorArr: [],
    };
    arr18[1].forEach(r => {
      obj.data[0].borderColorfulT.colorArr.push({
        offset: r[0],
        color: r[1],
      });
    });
    let borderColorfulT = JSON.parse(JSON.stringify(obj.data[0].borderColorfulT));
    obj.data[0].label.borderColor = new echarts.graphic.LinearGradient(...borderColorfulT.dir, borderColorfulT.colorArr,false);
  }
  return obj;
}
const exchangeBar = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    symbolSize: 0,												//默认，去除默认图片
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        name: '',													//默认，无文字
        label: {
          verticalAlign: 'bottom',				//默认，垂直对齐方式建议固定
          align: 'center',								//默认，水平对齐方式建议固定
          formatter:function(o){
            return o.name;
          },
        },
      },
      {
        name: '',													//默认，无文字
        label: {
          verticalAlign: 'bottom',				//默认，垂直对齐方式建议固定
          align: 'center',								//默认，水平对齐方式建议固定
          formatter:function(o){
            return o.name;
          },
        },
      }
    ],
  };
  
  let [ arr0, arr1, arr2, arr3 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15 ] = arr1;
  let [ arr20, arr21 ] = arr2;
  let [ arr30, arr31 ] = arr3;
  
  arr12[4] *= zoomScale;
  arr12[5] *= zoomScale;
  arr12[6] *= zoomScale;
  if (arr21.length) {
    arr21[1] *= zoomScale;
  }
  if (arr31.length) {
    arr31[0] *= zoomScale;
  }
  
  if (arr0.length) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['value'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
    obj.data[1].value = obj.data[0].value;
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['show', 'rotate', 'opacity', 'backgroundColor', 'width', 'height', 'borderWidth', 'borderColor'].forEach((i, ind) => {
      obj.data[0].label[i] = arr12[ind];
    });
    obj.data[1].label.show = obj.data[0].label.show;
    obj.data[1].label.rotate = obj.data[0].label.rotate;
    obj.data[1].label.width = obj.data[0].label.width;
    obj.data[1].label.opacity = obj.data[0].label.opacity;
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].label.show = showRuleCalc(obj.data[0].showT);
    // obj.data[1].label.show = obj.data[0].label.show;
    obj.data[0].label.show = true;
    obj.data[1].label.show = true;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  let pct = 0;
  if (arr14.length) {
    obj.data[0].statusT = {};
    ['id', 'val', 'min', 'max', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
    }
    let statusT = obj.data[0].statusT;
    if (statusT.val != null && statusT.val != undefined && statusT.val != '掉线' && statusT.val !== "" && (statusT.max - statusT.min != 0)) {
      pct = (Number(statusT.val) - statusT.min)/(statusT.max - statusT.min);
    }
  }
  if (arr15.length) {
    obj.data[0].alarmT = {};
    ['hSet', 'hColor', 'lSet', 'lColor'].forEach((i, ind) => {
      obj.data[0].alarmT[i] = arr15[ind];
    });
  }
  if (arr20.length) {
    
  }
  if (arr21.length) {
    ['backgroundColor'].forEach((i, ind) => {
      obj.data[1].label[i] = arr21[ind];
    });
    if (obj.data[0].alarmT) {
      let alarmT = obj.data[0].alarmT, statusT = obj.data[0].statusT;
      if (Number(statusT.val) > alarmT.hSet) {
        obj.data[1].label.backgroundColor = alarmT.hColor;
      } else if (Number(statusT.val) < alarmT.lSet) {
        obj.data[1].label.backgroundColor = alarmT.lColor;
      }
    }
    obj.data[1].label.height = obj.data[0].label.height * pct;
  }
  if (arr30.length && arr31.length) {
    obj.data.push({
      value: arr30[0],
      name: (pct * 100).toFixed(2) + '%',
      label: {
        verticalAlign: 'middle',												//默认，垂直对齐方式建议固定
        align: 'center',																//默认，水平对齐方式建议固定
        opacity: 1,																			//默认,文本透明度
        show: obj.data[0].label.show,										//默认,跟随
        rotate: 0,																			//默认,文本域倾斜角度
        formatter:function(o){
          return o.name;
        },
      },
    });
    ['fontSize', 'color', 'fontWeight', 'fontStyle', 'fontFamily'].forEach((i, ind) => {
      obj.data[2].label[i] = arr31[ind];
    });
  }
  return obj;
}
const exchangeLine = (item, zoomScale, ptype) => {
  let obj = {
    type: 'lines',												//默认，路径图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    emphasis: {														//默认，必须
      disabled: true,
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        lineStyle: {
          join: 'round',									//默认，节点处属性
        },
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15 ] = arr1;
  
  arr10[2] = [arr10[2][0]*zoomScale, arr10[2][1]*zoomScale];
  arr12[1] *= zoomScale;
  if (typeof(arr12[2]) !== 'string') {
    arr12[2] = [arr12[2][0]*zoomScale, arr12[2][1]*zoomScale];
  }
  arr12[3] *= zoomScale;
  if (arr15.length) {
    arr15[1] *= zoomScale;
    arr15[2] *= zoomScale;
    arr15[3] *= zoomScale;
  }
  
  if (arr0.length) {
    ['editType', 'z', 'polyline'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['coords', 'symbol', 'symbolSize'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['color', 'width', 'type', 'dashOffset', 'opacity', 'curveness'].forEach((i, ind) => {
      obj.data[0].lineStyle[i] = arr12[ind];
    });
    // obj.data[0].lineStyle.type_temp = typeof(arr12[2]) === "string" ? arr12[2] : "dashed";
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].lineStyle.opacity = showRuleCalc(obj.data[0].showT) ? obj.data[0].lineStyle.opacity : 0;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    
  }
  if (arr15.length) {
    ['shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'].forEach((i, ind) => {
      obj.data[0].lineStyle[i] = arr15[ind];
    });
  }
  return obj;
}

const exchangePipeline = (item, zoomScale, ptype) => {
  let obj = {
    type: 'lines',												//默认，路径图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    emphasis: {														//默认，必须
      disabled: true,
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        lineStyle: {
          join: 'round',									//默认，节点处属性
        },
      },
      {
        lineStyle: {
          join: 'round',									//默认，节点处属性
        },
      },
      {
        lineStyle: {
          join: 'round',									//默认，节点处属性
        },
      },
    ],
  };
  
  let [ arr0, arr1, arr2, arr3 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14 ] = arr1;
  let [ arr20, arr21 ] = arr2;
  let [ arr30, arr31, arr32 ] = arr3;
  
  arr12[3] *= zoomScale;
  arr21[2] *= zoomScale;
  arr31[2] *= zoomScale;
  arr31[3] = [arr31[3][0]*zoomScale, arr31[3][1]*zoomScale];
  arr31[4] *= zoomScale;
  
  if (arr0.length) {
    ['editType', 'z', 'polyline'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['coords'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
    obj.data[1].coords = JSON.parse(JSON.stringify(obj.data[0].coords));
    obj.data[2].coords = JSON.parse(JSON.stringify(obj.data[0].coords));
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['opacity', 'curveness', 'color', 'width'].forEach((i, ind) => {
      obj.data[0].lineStyle[i] = arr12[ind];
    });
    obj.data[1].lineStyle.curveness = obj.data[0].lineStyle.curveness;
    obj.data[2].lineStyle.curveness = obj.data[0].lineStyle.curveness;
  }
  let ifShow = true;
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    ifShow = showRuleCalc(obj.data[0].showT);
    obj.data[0].lineStyle.opacity = ifShow ? obj.data[0].lineStyle.opacity : 0;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    arr14[2].forEach((r, rnd) => {
      arr14[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr14[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].statusT = {};
    ['id', 'val', 'rule', 'effect', 'moveTime', 'speed', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
    }
    if (obj.data[0].statusT.effect === '变量控制' && !showRuleCalc(obj.data[0].statusT)) {
      obj.data[0].statusT.speed = 0;
    }
  }
  if (arr20.length) {
    
  }
  if (arr21.length) {
    ['opacity', 'color', 'width'].forEach((i, ind) => {
      obj.data[1].lineStyle[i] = arr21[ind];
    });
    // obj.data[0].lineStyle.width_temp = (obj.data[0].lineStyle.width - obj.data[1].lineStyle.width)/2;
    if (!ifShow) {
      obj.data[1].lineStyle.opacity = 0;
    }
  }
  if (arr30.length) {
    
  }
  if (arr31.length) {
    ['opacity', 'color', 'width', 'type', 'dashOffset'].forEach((i, ind) => {
      obj.data[2].lineStyle[i] = arr31[ind];
    });
    if (!ifShow) {
      obj.data[2].lineStyle.opacity = 0;
    }
  }
  if (arr32.length) {
    ['shadowColor', 'shadowBlur'].forEach((i, ind) => {
      obj.data[2].lineStyle[i] = arr32[ind];
    });
  }
  return obj;
}
const exchangePicture = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        itemStyle: {},
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15 ] = arr1;
  
  if (arr10?.length) {
    arr10[2] = [arr10[2][0]*zoomScale, arr10[2][1]*zoomScale];
  }
  
  if (arr0) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10) {
    ['value', 'symbol', 'symbolSize', 'symbolRotate'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  
  if (arr12?.length) {
    ['opacity'].forEach((i, ind) => {
      obj.data[0].itemStyle[i] = arr12[ind];
    });
  }
  if (arr13?.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].itemStyle.opacity = showRuleCalc(obj.data[0].showT) ? obj.data[0].itemStyle.opacity : 0;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    arr14[3].forEach((r, rnd) => {
      arr14[3][rnd] = {};
      ['con', 'val', 'show'].forEach((i, ind) => {
        arr14[3][rnd][i] = r[ind];
      });
    });
    obj.data[0].statusT = {};
    ['id', 'val', 'sym', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
    }
    obj.data[0].symbol = picRuleCalc(obj.data[0], ptype);
  }
  if (arr15?.length) {
    obj.data[0].pageT = {};
    ['fnc', 'page', 'prefix', 'title'].forEach((i, ind) => {
      obj.data[0].pageT[i] = arr15[ind];
    });
  }
  return obj;
}
const exchangeVButton = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        itemStyle: {},
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14 ] = arr1;
  
  arr10[2] = [arr10[2][0]*zoomScale, arr10[2][1]*zoomScale];
  
  if (arr0) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10) {
    ['value', 'symbol', 'symbolSize', 'symbolRotate'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12) {
    ['opacity'].forEach((i, ind) => {
      obj.data[0].itemStyle[i] = arr12[ind];
    });
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].itemStyle.opacity = showRuleCalc(obj.data[0].showT) ? obj.data[0].itemStyle.opacity : 0;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    
  }
  return obj;
}

const exchangeSwitch = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    emphasis: {
      disabled: true,											//默认，鼠标悬停不放大
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        itemStyle: {},
      },
    ],
  };
  
  let [ arr0, arr1 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15 ] = arr1;
  
  arr10[2] = [arr10[2][0]*zoomScale, arr10[2][1]*zoomScale];
  
  if (arr0) {
    ['editType', 'z'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10) {
    ['value', 'symbol', 'symbolSize', 'symbolRotate'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12) {
    ['opacity'].forEach((i, ind) => {
      obj.data[0].itemStyle[i] = arr12[ind];
    });
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].itemStyle.opacity = showRuleCalc(obj.data[0].showT) ? obj.data[0].itemStyle.opacity : 0;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    arr14[3].forEach((r, rnd) => {
      arr14[3][rnd] = {};
      ['con', 'val', 'show'].forEach((i, ind) => {
        arr14[3][rnd][i] = r[ind];
      });
    });
    obj.data[0].statusT = {};
    ['id', 'val', 'sym', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
      obj.data[0].statusT.id = item.status_suffix_sensor;
    }
    obj.data[0].symbol = picRuleCalc(obj.data[0], ptype);
  }
  if (arr15.length) {
    obj.data[0].writeT = {
      act: arr15[0],
      num: arr15[1],
    };
  }
  return obj;
}

const exchangeGauge = (item, zoomScale, ptype) => {
  let obj = {
    type: 'gauge',												//默认，仪表盘
    colorBy: 'series',										//默认，按照系列分配调色盘中的颜色，同一系列中的所有数据都是用相同的颜色；
    emphasis: {
      disabled: true,											//默认，hover时不高亮
    },
    detail: {
      show: false,												//默认，不显示数值详情
    },
    zlevel: 1,														//默认，图层
    data: [
      {
        title: {
          show: false,
        },
      },
    ],
    axisLine: {
      lineStyle: {},
    },
    splitLine: {
      distance: 0,												//默认，分隔线与轴线的距离。
      lineStyle: {},
    },
    axisTick: {
      distance: 0,												//默认，刻度线与轴线的距离。
      lineStyle: {},
    },
    axisLabel: {},
    pointer: {
      itemStyle: {},
    }
  };
  
  let [ arr0, arr1, arr2, arr3, arr4, arr5, arr6 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14, arr15, arr16 ] = arr1;
  let [ arr20, arr21 ] = arr2;
  let [ arr30, arr31 ] = arr3;
  let [ arr40, arr41 ] = arr4;
  let [ arr50 ] = arr5;
  let [ arr60, arr61 ] = arr6;
  
  arr0[3] *= zoomScale;
  if (arr15.length) {
    arr15[1] *= zoomScale;
    arr15[2] *= zoomScale;
  }
  if (arr16.length) {
    arr16[0] *= zoomScale;
  }
  arr21[1] *= zoomScale;
  arr30[0] *= zoomScale;
  arr31[1] *= zoomScale;
  arr40[1] *= zoomScale;
  arr41[1] *= zoomScale;
  arr50[1] *= zoomScale;
  arr50[2] *= zoomScale;
  arr60[0] *= zoomScale;
  arr60[1] *= zoomScale;
  
  if (arr0) {
    ['editType', 'z', 'center', 'radius', 'startAngle', 'endAngle', 'clockwise', 'min', 'max', 'splitNumber'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10) {
    ['name'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12) {
    
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
  }
  if (arr14.length) {
    obj.data[0].statusT = {};
    ['id', 'val', 'suffix'].forEach((i, ind) => {
      obj.data[0].statusT[i] = arr14[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].statusT.val = item.status_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].statusT.val = item.status_suffix_lastdata_cn;
    }
    obj.data[0].value = item.status_sensor__lastdata_cn;
  }
  if (arr15.length) {
    obj.data[0].title = {
      show: true,
      fontStyle: 'italic',
      color: arr15[0],
      fontSize: arr15[1],
      offsetCenter: [0, arr15[2]],
    }
  }
  if (arr16.length) {
    obj.progress = {
      clip: true,		//默认，裁掉超出部分
      show: true,
      width: arr16[0],
      itemStyle: {
        color: arr16[1],
      },
    };
  }
  if (arr20.length) {

  }
  if (arr21.length) {
    obj.axisLine.lineStyle = {
      color: [
        [1, arr21[0]],
      ],
      width: arr21[1],
    };
  }
  if (arr30.length) {
    ['length'].forEach((i, ind) => {
      obj.splitLine[i] = arr30[ind];
    });
  }
  if (arr31.length) {
    ['color', 'width'].forEach((i, ind) => {
      obj.splitLine.lineStyle[i] = arr31[ind];
    });
  }
  if (arr40.length) {
    ['splitNumber', 'length'].forEach((i, ind) => {
      obj.axisTick[i] = arr40[ind];
    });
  }
  if (arr41.length) {
    ['color', 'width'].forEach((i, ind) => {
      obj.axisTick.lineStyle[i] = arr41[ind];
    });
  }
  if (arr50.length) {
    ['color', 'fontSize', 'distance'].forEach((i, ind) => {
      obj.axisLabel[i] = arr50[ind];
    });
  }
  if (arr60.length) {
    ['length', 'width'].forEach((i, ind) => {
      obj.pointer[i] = arr60[ind];
    });
  }
  if (arr61.length) {
    ['color'].forEach((i, ind) => {
      obj.pointer.itemStyle[i] = arr61[ind];
    });
  }
  
  if (obj.data[0].showT && !showRuleCalc(obj.data[0].showT)) {
    return null;
    // obj.data[0].title.show = false;
    // if (obj.progress) {
    //   obj.progress.show = false;
    // }
    // obj.axisLine.show = false;
    // obj.splitLine.show = false;
    // obj.axisTick.show = false;
    // obj.axisLabel.show = false;
    // obj.pointer.show = false;
  }
  return obj;
}

const exchangeLineCharts = (item, zoomScale, ptype) => {
  let obj = {
    type: 'scatter',											//默认，散点图
    coordinateSystem: 'cartesian2d',			//默认，二维直角坐标系
    symbolSize: 0,												//默认，去除默认图片
    emphasis: {														//默认，去除鼠标移入时出现的symbol
      disabled: true,
    },
    zlevel: 1,														//默认，图层
    z: 11,																//默认，控制图形前后顺序
    data: [
      {
        label: {
          verticalAlign: "middle",												//默认，垂直对齐方式
          align: "center",																//默认，水平对齐方式
          opacity: 0,																	  	//默认为0，透明度，用dom渲染
        },
      },
    ],
    option: {
      animation: true,										  	  //默认，是否开启动画
      backgroundColor: 'rgba(0, 18, 24, 0)',    //默认，无背景颜色
      dataset: [],                              //默认，数据集
      series: [],                               //默认，系列
      tooltip: {
        trigger: 'axis',                        //默认，axis坐标轴触发，主要在柱状图，折线图等会使用类目轴的图表中使用。
        textStyle: {
          
        },
      },
      legend: {
        icon: 'rect',                         //默认，图例icon
        right: '2.5%',                        //默认，图例右边距
        textStyle: {
          
        },
      },
      grid: {
        containLabel: true,                   //默认，为true表示外边 距离 包含刻度标签在内的整个图表
        bottom: 10 * zoomScale,               //默认，网格离容器底部距离
        right: '2.5%',                        //默认，网格离容器右侧距离
        left: '2.5%',                         //默认，网格离容器左侧距离
      },
      xAxis: {
        boundaryGap: false,                   //默认， boundaryGap值为false的时候，折线第一个点在y轴上
        type: 'time',                         //默认，时间轴
        axisLabel: {
          
        },
      },
      yAxis: {
        type: 'value',                        //默认，数值轴
        axisLabel: {
          
        },
        splitLine: {
          lineStyle: {
            
          },
        },
        nameTextStyle: {
          
        },
      },
    },
    params: [],
  };
  
  let [ arr0, arr1, arr2, arr3 ] = JSON.parse(item.front_data);
  let [ arr10, arr11, arr12, arr13, arr14 ] = arr1;
  let [ arr20, arr21, arr22, arr23, arr24, arr25 ] = arr2;
  
  arr12[4] *= zoomScale;
  arr12[5] *= zoomScale;
  arr12[6] *= zoomScale;
  if (arr21.length) {
    if (arr21[1].length) {
      arr21[1][1] *= zoomScale;
    }
  }
  if (arr22.length) {
    if (arr22[0].length) {
      arr22[0][0] *= zoomScale;
      arr22[0][1] *= zoomScale;
      arr22[0][2] *= zoomScale;
    }
    if (arr22[1].length) {
      arr22[1][1] *= zoomScale;
    }
  }
  if (arr23.length) {
    if (arr23[0].length) {
      arr23[0][0] *= zoomScale;
    }
  }
  if (arr24.length) {
    if (arr24[1].length) {
      arr24[1][1] *= zoomScale;
    }
  }
  if (arr25.length) {
    if (arr25[1].length) {
      arr25[1][1] *= zoomScale;
    }
    if (arr25[3].length) {
      arr25[3][1] *= zoomScale;
    }
  }
  
  if (arr0.length) {
    ['editType'].forEach((i, ind) => {
      obj[i] = arr0[ind];
    });
  }
  if (arr10.length) {
    ['value'].forEach((i, ind) => {
      obj.data[0][i] = arr10[ind];
    });
  }
  obj.data[0]['needObjs'] = arr11;
  if (arr12.length) {
    ['show', 'rotate', 'opacity_temp', 'backgroundColor', 'width', 'height', 'borderWidth', 'borderColor', 'shadow'].forEach((i, ind) => {
      obj.data[0].label[i] = arr12[ind];
    });
  }
  if (arr13.length) {
    arr13[2].forEach((r, rnd) => {
      arr13[2][rnd] = {};
      ['con', 'val', 'ope'].forEach((i, ind) => {
        arr13[2][rnd][i] = r[ind];
      });
    });
    obj.data[0].showT = {};
    ['id', 'val', 'rule', 'suffix'].forEach((i, ind) => {
      obj.data[0].showT[i] = arr13[ind];
    });
    if (ptype === '切换页面' || ptype === '弹出画面') {
      obj.data[0].showT.val = item.show_sensor__lastdata_cn;
    } else if (ptype === '公共弹窗') {
      obj.data[0].showT.val = item.show_suffix_lastdata_cn;
    }
    // obj.data[0].label.show = showRuleCalc(obj.data[0].showT);
    obj.data[0].label.show = true;
    if (!showRuleCalc(obj.data[0].showT)) {
      return null;
    }
  }
  if (arr14.length) {
    
  }
  if (arr20.length) {
    
  }
  if (arr21.length) {
    if (arr21[0].length) {
      ['backgroundColor', 'borderColor'].forEach((i, ind) => {
        obj.option.tooltip[i] = arr21[0][ind];
      });
    }
    if (arr21[1].length) {
      ['color', 'fontSize'].forEach((i, ind) => {
        obj.option.tooltip.textStyle[i] = arr21[1][ind];
      });
    }
  }
  if (arr22.length) {
    if (arr22[0].length) {
      ['top', 'itemWidth', 'itemHeight'].forEach((i, ind) => {
        obj.option.legend[i] = arr22[0][ind];
      });
    }
    if (arr22[1].length) {
      ['color', 'fontSize'].forEach((i, ind) => {
        obj.option.legend.textStyle[i] = arr22[1][ind];
      });
    }
  }
  if (arr23.length) {
    if (arr23[0].length) {
      ['top'].forEach((i, ind) => {
        obj.option.grid[i] = arr23[0][ind];
      });
    }
  }
  if (arr24.length) {
    if (arr24[1].length) {
      ['color', 'fontSize'].forEach((i, ind) => {
        obj.option.xAxis.axisLabel[i] = arr24[1][ind];
      });
    }
  }
  if (arr25.length) {
    if (arr25[1].length) {
      ['color', 'fontSize'].forEach((i, ind) => {
        obj.option.yAxis.axisLabel[i] = arr25[1][ind];
      });
    }
    if (arr25[2].length) {
      if (arr25[2][1].length) {
        ['color'].forEach((i, ind) => {
          obj.option.yAxis.splitLine.lineStyle[i] = arr25[2][1][ind];
        });
      }
    }
    if (arr25[3].length) {
      ['color', 'fontSize'].forEach((i, ind) => {
        obj.option.yAxis.nameTextStyle[i] = arr25[3][ind];
      });
    }
  }
  if (arr3.length) {
    obj.params = arr3;
  }
  return obj;
}


const showRuleCalc = (showT) => {
  const rule = showT.rule;
  const length = rule.length;
  let show = false;
  const f = showT.val;
  for (var i = 0; i < length; i ++) {
    const s = rule[i].con, b = rule[i].val;
    if (s === '>') {
      show = +f > +b ? true : false;
    } else if (s === '>=') {
      show = +f >= +b ? true : false;
    } else if (s === '==') {
      show = f == b ? true : false;
    } else if (s === '<=') {
      show = +f <= +b ? true : false;
    } else if (s === '<') {
      show = +f < +b ? true : false;
    } else if (s === '!=') {
      show = f != b ? true : false;
    }
    if (rule[i].ope === 'None' || rule[i].ope === 'And' && show === false || rule[i].ope === 'Or' && show === true) {
      break;
    }
  }
  return show;
}

const picRuleCalc = (data0, ptype) => {
	let symbol = data0.symbol, flag = null, statusT = data0.statusT;
  if (ptype === '公共弹窗' && statusT.suffix || statusT.id) {
    const f = statusT.val;
    statusT.rule.forEach(rule => {
    	const s = rule.con, b = rule.val;
    	if (s === '>' && +f > +b) {
    		flag = +rule.show;
    	} else if (s === '>=' && +f >= +b) {
    		flag = +rule.show;
    	} else if (s === '==' && f == b) {
    		flag = +rule.show;
    	} else if (s === '<=' && +f <= +b) {
    		flag = +rule.show;
    	} else if (s === '<' && +f < +b) {
    		flag = +rule.show;
    	} else if (s === '!=' && f != b) {
    		flag = +rule.show;
    	}
    });
    if (flag && flag <= statusT.sym.length && statusT.sym[flag - 1]) {
    	symbol =  `${'image://https://hengji.ieieye.com' + statusT.sym[flag - 1]}`;
    }
  }
	return symbol;
}